import React, { useEffect } from 'react';
import { Form } from 'antd';
import styles from './index.less';

const HeadBox = ({ handleComponentInit, children }) => {
  const [form] = Form.useForm();

  const searchReset = (value) => {
    form.resetFields();
  };

  useEffect(() => {
    handleComponentInit && handleComponentInit(form);
    form.resetFields();
  }, []);

  return (
    <div className={styles.header}>
      <div className={styles.search}>
        <Form form={form} className={styles.form}>
          <div className={styles.select}>{children(form, searchReset)}</div>
        </Form>
      </div>
    </div>
  );
};
export default HeadBox;
